package com.day6;
import java.util.Scanner;
public class Test08 {
    public static void main(String[] args) {
        int[] arr={19,28,37,46,55};
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入要查找的数据：");
        int number=sc.nextInt();
        int index=getIndex(arr,number);
        System.out.println("查找到的下标为："+index);
    }

    public static int getIndex(int[] arr,int number) {
        int index=-1;
        for(int x=0;x<arr.length;x++){
            if(arr[x]==number){
                index=x;
                break;
            }
        }
        return index;
    }
}
